﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace FiftyNine.Ag.CommandManager.Commands
{
    public class DelegateCommand<T> : ICommand
    {
        Action<T> _action;

        public DelegateCommand(Action<T> callback)
        {
            _action = callback;
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public void Execute(object parameter)
        {
            _action((T)parameter);
        }

        public event EventHandler CanExecuteChanged;
    }
    public class DelegateCommand : DelegateCommand<object>
    {
        public DelegateCommand(Action callback) : base(o => callback())
        {
        }
    }
}
